
/*
 * Karvaly.DOM.MouseEvent
 * depends: Karvaly.DOM.Event
 */
Karvaly.DOM.MouseEvent = (function() {
    
    // imports
    var Class = Karvaly.Class;
    var Event = Karvaly.DOM.Event;
    
    // class
    var MouseEvent = new Class(Event, {
	constructor : function(event) {
	    this.initMouseEvent(event);
	},
	initMouseEvent : function(event) {
	    if (!event) return;
	    this.initEvent(event);
	    this.clientX = event.clientX;
	    this.clientY = event.clientY;
	    this.screenX = event.screenX;
	    this.screenY = event.screenY;
	    this.relatedTarget = 'relatedTarget' in event
	    ? event.relatedTarget
		    : this.target === event.toElement
		    ? event.fromElement
			    : this.target === event.fromElement
			    ? event.toElement : null;
	}
    });
    
    return MouseEvent;
})();
